home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Tutorial
/
Cookbook
/
42.DocApp
/
DocApp.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
810b
|
45 lines
/* Generated by Interface Builder */
#import "DocApp.h"
#import "Document.h"
#import <appkit/defaults.h>
#import <appkit/OpenPanel.h>
#import <appkit/SavePanel.h>
@implementation DocApp
- newDocument:sender
{
[Document new];
if (DEBUGGING) printf("in DocApp new.\n");
return self;
}
- openDocument:sender
{
static char *const docTypes[] = {FILEEXT, NULL};
if ([[self openPanel] runModalForTypes:docTypes])
if ([Document newFromFile:[[self openPanel] filename]] == nil)
NXRunAlertPanel (NULL, "Could not open file.", "OK", NULL, NULL);
return self;
}
// Outlet Initialization
- openPanel
{
if(!openPanel) openPanel = [OpenPanel new];
return openPanel;
}
- savePanel
{
if(!savePanel) savePanel = [SavePanel new];
[savePanel setRequiredFileType:FILEEXT];
return savePanel;
}
@end